home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
050
/
madtrb1.arc
/
G_I_TPL.GEN
< prev
next >
Wrap
Text File
|
1986-03-27
|
12KB
|
272 lines
{ G_I_TPL.GEN }
{ *************************************************************************** }
{ * * }
{ * TURBO SCREEN INPUT PRE-PROCESSOR TOOLKIT * }
{ * * }
{ * GENERAL INPUT SCREEN TEMPLATE GENERATOR * }
{ * * }
{ * Version 1.07 * }
{ * * }
{ * * }
{ * This template generator provides a method of inputing the input * }
{ * prompt parameters for the general input page template used in the * }
{ * general input pages for the pre-processor storing them in a template * }
{ * file so that they can be read and used by the general input page * }
{ * subprogram. * }
{ * * }
{ *************************************************************************** }
Procedure FileGeneratorModule;
{ *************************************************************************** }
{ * * }
{ * SCREEN TEMPLATE GENERATOR MODULE * }
{ * * }
{ * This module reads the record entries out of a file, places the entries * }
{ * in an array, allows you to inspect the entries and change them if so * }
{ * desired, and then writes the record entries back to the file. * }
{ * * }
{ * This screen template generator is used to generate a template which * }
{ * stores the following information about each entry in its record: * }
{ * * }
{ * PromptCol ( column location of input prompt on screen ) * }
{ * PromptRow ( row location of input prompt on screen ) * }
{ * InputCol ( column location of input data entry field ) * }
{ * InputRow ( row location of input data entry field ) * }
{ * InputLength ( maximum length of input data entry ) * }
{ * InputDataType: * }
{ * * }
{ * 1 = Positive Integer * }
{ * 2 = Negative Integer * }
{ * 3 = Integer * }
{ * 4 = Positive Real * }
{ * 5 = Negative Real * }
{ * 6 = Real * }
{ * 7 = File Name Characters * }
{ * 8 = Disk Drive Subdirectory Path Characters * }
{ * 9 = General Characters * }
{ * * }
{ * ReturnKeyPointer ( pointer to corresponding record for a * }
{ * carriage return entry ) * }
{ * UpKeyPointer ( pointer to corresponding record for a up * }
{ * key entry ) * }
{ * DownKeyPointer ( pointer to corresponding record for a down * }
{ * key entry ) * }
{ * LeftKeyPointer ( pointer to corresponding record for a left * }
{ * key entry ) * }
{ * RightKeyPointer ( pointer to corresponding record for a right * }
{ * key entry ) * }
{ * * }
{ *************************************************************************** }
{$V-}
Const
TEMPLATE_RECORD_LIMIT=26; { number of records used in the template }
TEMPLATE_FILE_NAME='G_I_01.TPL'; { name of template file being generated }
MAX_SIZE_OF_G_I_PROMPT=50; { size of general input prompt string }
Type
TemplateRecord= { record type used for general input page templates, used to store }
Record { specific information about a particular general input page prompt }
PromptCol:Integer;
PromptRow:Integer;
InputCol:Integer;
InputRow:Integer;
InputLength:Integer;
InputDataType:Integer;
ReturnKeyPointer:Integer;
UpKeyPointer:Integer;
DownKeyPointer:Integer;
LeftKeyPointer:Integer;
RightKeyPointer:Integer;
Prompt:String[MAX_SIZE_OF_G_I_PROMPT];
End; { TemplateRecord }
Var
Template:Array[1..TEMPLATE_RECORD_LIMIT] of TemplateRecord; { an array used to store the template }
TemplateFile:File Of TemplateRecord; { a file type used to store templates }
RecordNumber:Integer; { a index to the current template record being updated }
RecordOK:Char; { a character variable read from the keyboard }
Procedure InitializeTemplateEntries;
{ This procedure initializes the entries in the template array of records.
This procedure removes any garbage that might have been in the memory
locations that the template array now uses. }
Var
RecordNumber:Integer; { a index counter to a template record }
Begin { InitializeTemplateEntries }
For RecordNumber:=1 To TEMPLATE_RECORD_LIMIT Do
With Template[RecordNumber] Do
Begin
PromptCol:=0;
PromptRow:=0;
InputCol:=0;
InputRow:=0;
InputLength:=0;
InputDataType:=0;
ReturnKeyPointer:=0;
UpKeyPointer:=0;
DownKeyPointer:=0;
LeftKeyPointer:=0;
RightKeyPointer:=0;
Prompt:='';
End; { With Template }
End; { InitializeTemplateEntries }
Procedure ReadFileEntries;
{ This procedure reads the entries out of the template file named above and
stores the entries into the proper template array record. }
Var
RecordNumber:Integer; { a index counter to a template record }
Begin { ReadFileEntries }
RecordNumber:=1; { initialize record number counter }
{$I-} { enable error trapping }
Assign(TemplateFile,TEMPLATE_FILE_NAME); { assign to a disk file }
Reset(TemplateFile); { open the file for reading }
If IOResult=0 Then { if file exists then start reading of file }
Repeat
Read(TemplateFile,Template[RecordNumber]); { read record off of disk }
RecordNumber:=RecordNumber+1; { increment record number counter }
Until (IOResult<>0) Or (RecordNumber=TEMPLATE_RECORD_LIMIT+1); { read until end of file or template record limit }
Close(TemplateFile); { close the template file }
{$I+} { disable error trapping }
End; { ReadFileEntries }
Procedure WriteFileEntries;
{ This procedure takes the entrys stored in the template array records and
writes them to the template file named above. }
Var
RecordNumber:Integer; { a index counter to a template record }
Begin { WriteFileEntries }
Assign(TemplateFile,TEMPLATE_FILE_NAME); { assign to a file on disk }
Rewrite(TemplateFile); { open the file for writing, removes any previous entries }
For RecordNumber:=1 To TEMPLATE_RECORD_LIMIT Do
Write(TemplateFile,Template[RecordNumber]); { put the next record out }
Close(TemplateFile);
End; { WriteFileEntries }
Procedure ShowTemplateRecord;
{ This procedure shows the operator the template entries in the template array
for the current record number. }
Begin { ShowTemplateRecord }
With Template[RecordNumber] Do
Begin
WriteLn('Record Number= ',RecordNumber);
WriteLn;
WriteLn('PromptCol= ',PromptCol);
WriteLn('PromptRow= ',PromptRow);
WriteLn('InputCol= ',InputCol);
WriteLn('InputRow= ',InputRow);
WriteLn('InputLength= ',InputLength);
WriteLn('InputDataType= ',InputDataType);
WriteLn('ReturnKeyPointer= ',ReturnKeyPointer);
WriteLn('UpKeyPointer= ',UpKeyPointer);
WriteLn('DownKeyPointer= ',DownKeyPointer);
WriteLn('LeftKeyPointer= ',LeftKeyPointer);
WriteLn('RightKeyPointer= ',RightKeyPointer);
WriteLn('Prompt= ',Prompt);
End; { With Template[RecordNumber] }
End; { ShowTemplateRecord }
Procedure EnterTemplateRecord;
{ This procedure reads the template entries from the user and places them
into the current template record. }
Begin { EnterTemplateRecord }
With Template[RecordNumber] Do
Begin
WriteLn('Record Number=',RecordNumber);
WriteLn;
Write('PromptCol= ?');
ReadLn(PromptCol);
Write('PromptRow= ?');
ReadLn(PromptRow);
Write('InputCol= ?');
ReadLn(InputCol);
Write('InputRow= ?');
ReadLn(InputRow);
Write('InputLength= ?');
ReadLn(InputLength);
Write('InputDataType= ?');
ReadLn(InputDataType);
Write('ReturnKeyPointer= ?');
ReadLn(ReturnKeyPointer);
Write('UpKeyPointer= ?');
ReadLn(UpKeyPointer);
Write('DownKeyPointer= ?');
ReadLn(DownKeyPointer);
Write('LeftKeyPointer= ?');
ReadLn(LeftKeyPointer);
Write('RightKeyPointer= ?');
ReadLn(RightKeyPointer);
Write('Prompt= ?');
ReadLn(Prompt);
End; { With Template[RecordNumber] }
End; { EnterTemplateRecord }
Begin { FileGeneratorModule }
RecordNumber:=1; { initialize the record index }
InitializeTemplateEntries;
ReadFileEntries;
Repeat
ClrScr;
ShowTemplateRecord;
WriteLn;
Write('Are the above entries correct (Y or N) ?');
ReadLn(RecordOK);
If (RecordOK<>'Y') And (RecordOK<>'y') Then
Begin
ClrScr;
EnterTemplateRecord;
End { If (RecordOK<> }
Else { increment record index }
RecordNumber:=RecordNumber+1;
Until RecordNumber=TEMPLATE_RECORD_LIMIT+1;
WriteFileEntries;
End; { FileGeneratorModule }
Begin { Main Program }
FileGeneratorModule;
End. { Main Program }